// =====================
// |    
// |    
// | http://wh-em.com
// =====================
$note_limit="5"; //       
if ($_REQUEST['do'] == "add_note") {
$msg = "
<thead><tr><td colspan='2' class='thead' colspan='2'> </td></tr></thead>
<tbody>
<form method='POST' action='global.php?do=do_add_note'>
<td class='alt2' align='center'>  :</td>
<td class='alt2' align='center'>$bbuserinfo[username]</td>
</tr><tr>
<td class='alt1' align='center'>  :</td>
<td class='alt1' align='center'>
<input class='button' size='50' type='text' name='titel' size='50'></td>
</tr><tr>
<td class='alt1' align='center'>  :</td>
<td class='alt1' align='center'>
<textarea rows='8' cols='31' name='note'></textarea></td>
</tr>
<tr>
<td colspan='2' class='tfoot' align='left'>
<p align='center'><input type='submit' class='button' value=''></form></td>
</tr>
</tbody>
";
if (!$bbuserinfo['userid']) {
$msg = "<td class=\"alt2\" align=\"center\">  </td>";
}
eval('print_output("' . fetch_template('note') . '");');
}
elseif ($_REQUEST['do'] == "do_add_note") {
if (!$_POST['titel']) {
$msg = "<td class=\"alt2\" align=\"center\"> ..    </td>";
} elseif (!$_POST['note']) {
$msg = "<td class=\"alt2\" align=\"center\"> ...    </td>";
} elseif (strlen($_POST['note']) > 500) {
$msg = "<td class=\"alt2\" align=\"center\"> ...       500 </td>";
} else {
$_POST['note'] = str_replace("<", "&lt;", $_POST['note']);
$_POST['note'] = str_replace(">", "&gt;", $_POST['note']);
$DB_site->query("INSERT INTO nota  (id,name,titel,note) VALUES ('','$bbuserinfo[username]','$_POST[titel]','$_POST[note]')");
$msg = "<td class=\"alt2\" align=\"center\">   </td>
<META HTTP-EQUIV='Refresh' CONTENT='2;URL=javascript:self.close()'>
";
}
eval('print_output("' . fetch_template('note') . '");');
}
elseif ($_REQUEST['do'] == "view") {
 $note_1 = $DB_site->query("SELECT * FROM nota WHERE name = '$bbuserinfo[username]' and id = '$id' ORDER BY id DESC LIMIT $note_limit ");
while ($note_row = mysql_fetch_array($note_1)) {
$id=$note_row[id];
$note_row[note]   = nl2br($note_row[note]);
$note_bit .= "
<table class='tborder'
cellspacing='1' border='0' width='100%' id='table4' height='100%'>
<tr>
<td class='alt1'>
$note_row[titel]</td>
</tr>
<tr><td class='thead' align='center' valign='top' height='100%'>
$note_row[note]
  <br><br>
<font color='#FF0000'>
(
</font>
<a href=\"admin_note.php?do=edit&id=" . $note_row[id] . "\"></a>
<font color='#FF0000'>
|
</font>
<a href=\"admin_note.php?do=delete&id=" . $note_row[id] . "\"></a>
<font color='#FF0000'>
)
</font>
</td></tr></table>
<br>
";
}
$the_notes = "$note_bit";
$msg ="$the_notes";
eval('print_output("' . fetch_template('notes') . '");');
}
elseif ($_REQUEST['do'] == "showall") {
 $note_1 = $DB_site->query("SELECT * FROM nota WHERE name = '$bbuserinfo[username]'  ORDER BY id DESC");
while ($note_row = mysql_fetch_array($note_1)) {
$id=$note_row[id];
$note_row[note]   = nl2br($note_row[note]);
$note_bit .= "
<table class='tborder'
cellspacing='1' border='0' width='100%' id='table4' height='100%'>
<tr>
<td class='alt1'>
$note_row[titel]</td>
</tr>
<tr><td class='thead' align='center' valign='top' height='100%'>
$note_row[note]
  <br><br>
<font color='#FF0000'>
(
</font>
<a href=\"admin_note.php?do=edit&id=" . $note_row[id] . "\"></a>
<font color='#FF0000'>
|
</font>
<a href=\"admin_note.php?do=delete&id=" . $note_row[id] . "\"></a>
<font color='#FF0000'>
)
</font>
</td></tr></table>
<br>
";
}
$the_notes = "$note_bit";
$msg ="$the_notes";
eval('print_output("' . fetch_template('notes') . '");');
}
else {
$note_1 = $DB_site->query("SELECT * FROM nota WHERE name = '$bbuserinfo[username]' ORDER BY id DESC LIMIT $note_limit ");
	$totalnote = mysql_num_rows($note_1);
while ($note_row = mysql_fetch_array($note_1)) {
$note_bit .= "
<font color='#FF0000'>
*-</font>
<a href=#
onclick=window.open('global.php?do=view&id=" . $note_row[id] . "','show_note','statusbar=yes,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=450,height=400');>
$note_row[titel]
</a>
<b><font color='#008000'>
.</font></b>
<br>
";
}
$the_notes = "$note_bit<br>";
}
// =====================
// |    
// |    
// | http://wh-em.com
// =====================